package com.goldcn.user.controller;

import com.goldcn.user.model.Permissions;
import com.goldcn.user.service.PermissionsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by 1111 on 2016/11/9.
 */
@Api(value = "权限功能")
@RestController
@RequestMapping(value = "/permissions")
public class PermissionsController {
    @Autowired
    PermissionsService permissionsService;

    /**
    @ApiOperation(value = "新增权限功能")
    @RequestMapping(method = RequestMethod.POST)
    public Object addPermissions(@RequestBody Permissions permissions){
        return permissionsService.addPermissions(permissions);
    }

    @ApiOperation(value = "修改权限功能")
    @RequestMapping(method = RequestMethod.PUT)
    public Object updatePermissions(@RequestBody Permissions permissions){
        return permissionsService.updatePermissions(permissions);
    }

    @ApiOperation(value = "根据ID查询权限功能")
    @RequestMapping(value = "/{psID}",method = RequestMethod.GET)
    public Object selectByPsID(@PathVariable Long psID){
        return permissionsService.selectPermissions(psID);
    }

    @ApiOperation(value = "删除权限功能")
    @RequestMapping(value = "/{psID}",method = RequestMethod.DELETE)
    public Object deletePermissions(@PathVariable Long psID){
        return permissionsService.deletePermissions(psID);
    }

    @ApiOperation(value = "是否停用")
    @RequestMapping(value = "/isStop",method = RequestMethod.PUT)
    public Object updateIsStop(@RequestBody StateDto stateDto){
        return permissionsService.updateIsStop(stateDto);
    }
    */
    @ApiOperation(value = "按条件查询权限功能列表")
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public Object selectByPermissions(@RequestBody Permissions permissions){
        return permissionsService.selectByPermissions(permissions);
    }
}
